{% extends 'index_base.html' %}

{% block head %}{% endblock %}

{% block title %}主页{% endblock %}

{% block main %}
    <a href="{{ url_for('app.exp_excel') }}" class="layui-btn layui-btn-sm">
        <i class="layui-icon layui-icon-file">&#xe621;</i>生成Excel
    </a>
    <button type="button" id="sub-btn" class="layui-btn">点击</button>
<table class="layui-table">
  <colgroup>
    <col width="150">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>ID</th>
      <th>邮箱</th>
      <th>昵称</th>
      <th>状态</th>
      <th>加入时间</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
  {% for user in users %}
    <tr>
      <td>{{ user.id }}</td>
      <td>{{ user.email }}</td>
      <td>{{ user.username }}</td>
      <td>
        {% if user.enabled %}
            <span class="layui-badge layui-bg-green">已激活</span>
        {% else %}
            <span class="layui-badge">未激活</span>
        {% endif %}
      </td>
      <td>{{ user.join_time }}</td>
      <td>激活操作</td>
    </tr>
  {% endfor %}
  </tbody>
</table>

{#<div id="pages"></div>#}

{% endblock %}


{% block lay_js %}
    <script type="text/javascript">
        layui.use(['layer','laypage','table'],function () {
            var layer = layui.layer
                ,table = layui.table
                ,laypage = layui.laypage
                ,$ = layui.$;
            table.render();
            $('button#sub-btn').click(function () {
                layer.confirm('确定要点击按钮?', {
                    btn:['是', '否']
                },function () {
                    layer.msg('你点击了我！')
                },function () {
                    layer.msg('你取消了操作！')
                });
            });
    });

    </script>
{% endblock %}